import os

from .json_helper import json_helper
from .dataset_tools import dataset_tools

class QXSLAB_tools(dataset_tools):
    key = "QXSLAB_SAROPT"


    def get_wkt(self, sample) -> str:
        """
        image name to wkt
        
        Param
        -----
        sample the identifier of sample, e.g. path or point
        """
        sample = os.path.basename(sample)
        sample = os.path.splitext(sample)[0]
        wkt = sample
        
        return wkt



if __name__ == "__main__":
    import numpy as np
    import cv2 as cv

    dt = QXSLAB_tools("", "E:/workspace/SOMatch/json/QXSLAB_SAROPT/SanDiego.json")
    print(f"{len(dt)} pairs loaded")
    lt = dt.get_pair_list()
    img0 = dt.get_patch(lt[1000][0])
    img1 = dt.get_patch(lt[1000][1])
    img = np.concatenate((img0, img1), axis=1)
    cv.imshow("", img)
    cv.waitKey(4000)
